perm filename ALPHA.TEX[ALF,DEK] blob sn#598529 filedate 1981-07-09 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00010 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	\input basic % ALPHATEX DOCUMENTATION
C00004 00003	\yskip % INTRODUCTORY DEFINITIONS
C00009 00004	\vfill\eject % THE INSTRUCTION SET
C00023 00005	\vfill\eject % TALKING BACK
C00030 00006	\vfill\eject % IMPORTANT RESTRICTIONS
C00036 00007	\vfill\eject % PROCESSING SUGGESTIONS
C00048 00008	\vfill\eject % OPERATOR'S MANUAL
C00058 00009	\vfill\eject % APPENDIX
C00059 00010	\vfill\end
C00060 ENDMK
C⊗;
\input basic % ALPHATEX DOCUMENTATION
\font t←cmtt \def\tt{\:t} % typewriter style
\def\AlphaTEX{\hbox{Alpha\hskip-1.8pt
	T\hskip-1.8pt\lower1.75pt\hbox{E}\hskip-1.8pt X}}
\def\ready{\hbox{\it ready}}
\def\xskip{\hskip 7pt plus 3pt minus 4pt}
\def\yskip{\vskip 3pt plus 6pt minus 1pt}
\def\9{\hskip .5em}
\rm

\noindent{\bf \AlphaTEX: the boustrophedonic
typesetting software for an Alphatype CRS machine.}

\vskip 20pt
One du (dot unit) equals 9/32000 inch.

One fu (feed unit) equals 5/8000 inch.

All $x$ coordinates are given in du, all $y$ coordinates are given in fu.
The upper left corner is \hbox{(0 du, 0 fu)}; the lower right corner is
\hbox{(55487 du, 29190 fu)}. This represents an area of about 15.6" wide by
18.3" tall.

The 55488 du overall width is divided into 1734 groups of 32 du each,
called ``cogs,'' numbered from 2048 to 3781 inclusive. Thus, a horizontal
coordinate $x$ belongs to cog number $\lfloor x/32 \rfloor + 2048$.

\yskip
A (smart) preprocessing routine called Alphahost will send typesetting
instructions and font data to (stupid) \AlphaTEX. \AlphaTEX\ does little or no
checking for software errors, so it will probably screw up if Alphahost does
not follow the restrictions stated below.
\yskip % INTRODUCTORY DEFINITIONS
Before listing the instructions understood by \AlphaTEX, it is convenient to
define some terminology. At any time \AlphaTEX\ is said to be either in `LR'
state (meaning that the current line being output or the next line to be
output will be typeset from left to right), or `RL' state (which is similar, but
right to left), or `blank' state (the initial state at the beginning of each
piece of film). Furthermore it has either 0, 1, or 2 lines of text ready to be
typeset, indicated by the value of an internal variable called \ready\
(which equals 0, 1, or 2).

The software handles transmission of information between Alphahost and
\AlphaTEX\ via an RS232 interface. Most of the communication consists of bytes that
are transmitted from Alphahost to \AlphaTEX, but there are also some commands sent
the other way, namely `The last batch of characters you sent were received
satisfactorily (or unsatisfactorily)', `I'm awake', and
`I quit'. The quit message is sent only if the operator wants to abort the job,
for example when a hardware malfunction has been detected.

Characters are assigned arbitrary reference codes $c$, in the range $3≤c≤255$.
These codes have no particular meaning, they are just used as abbreviations so that
fewer bytes need to be transmitted; in fact, the same character might be
abbreviated in several different ways during the course of a single job. At any given
time each character code $c$ is in one of several states: It is either `unknown',
meaning that Alphahost had better define it before using it, or it is `known'.
Furthermore it is either `active', meaning that it appears in one of the lines of
text that \AlphaTEX\ has ready, or in the partially completed line that
\AlphaTEX\ is readying; or it is `inactive'. Unknown character codes must be
inactive, but known codes can be either active or inactive. At any
time Alphahost may decide that an inactive character is unknown;
\AlphaTEX\ doesn't really know which codes it really knows. But Alphahost
always knows the state of all codes.
\vfill\eject % THE INSTRUCTION SET
\noindent Here now are the operations \AlphaTEX\ can do, together with their
representations in terms of a variable number of bytes:

\def\op #1. #2.{\penalty-100\yskip\yskip
\noindent $\bullet$\xskip$#1$.\xskip {\bf#2.}\par\penalty1000\yskip\noindent\!}
\chcode'246←'2046 % makes & a binary operator in math mode

\op 0&c&m↓0&m↓1&n↓0&n↓1&(\hbox{$n$ bytes of boundary data}). New character.
Here $3≤c≤255$ is the number of a character that is currently inactive;
$n=n↓1n↓0$ is the number of bytes of boundary data needed to represent it with
Alphatype's encoding; and $m=m↓1m↓0$ is a location in the \AlphaTEX\ repertoire
of known character shapes, where locations $m$ thru $m+n+2$ are not presently
in use for known characters. \AlphaTEX\ loads the $n$ bytes of boundary data,
followed by three standard ending bytes 0&0&248, into these locations,
and it will associate this data with character code $c$ until
new information for $c$ is supplied by Alphahost. Code $c$ becomes known, and
whenever it is inactive Alphahost may decide that it is unknown.
The current values of $A$ and $B$ are used as `multipliers' for $c$ (see the
Change-multiplier instruction below).

Locations within \AlphaTEX\ that will be available for storing known
characters appear in two blocks $[l↓1,r↓1)$ and $[l↓2,r↓2)$ of more than 13000
bytes each. In hexadecimal notation, $l↓1=\hbox{\tt 4020}$, $r↓1=\hbox{\tt 7300}$,
$l↓2=\hbox{\tt 850E}$, $r↓2=\hbox{\tt BC18}$. Actually $l↓2$ can be decreased by
4 for every character reference code 255, 254, etc., that is not used. For
example, by confining all characters to the range $3≤c≤100$ you can gain 
$155\times4=620$ bytes for the repertoire. There also is a way to change $r↓2$
to $r↓2-5x$ if \AlphaTEX's maximum line buffer length is changed to $200+x$;
see the appendix.

\op 1&a↓0&a↓1&b↓0&b↓1. Change multipliers.
\AlphaTEX\ will reset
$A←a↓1a↓0$ and $B←b↓1b↓0$, where these values are both less than 2048.\xskip
(Initially $A=1365$ and $B=2047$, the values normally used with METAFONT
output.)\xskip The values of $A$ and $B$ are used as multipliers on the
bit patterns of subsequent characters, where $A$ applies to the $x$
direction and $B$ to the $y$ direction.\xskip(The values of $A$
and $B$ are used only by the New-character instruction.)

\op 2&c&m↓0&m↓1. Shuffle character memory.
The data for character $c$ (which must be known to \AlphaTEX) is moved into
memory locations beginning at $m=m↓1m↓0$, where $m$ is less than
or equal to the current beginning location for $c$'s data. All characters
presently associated with locations between $m$ and this former beginning
location become unknown. This instruction is used to repack memory if Alphahost
feels such repacking would be wise.\xskip(Repacking takes about 19 microseconds
per byte moved.)\xskip 
\AlphaTEX\ waits until $\ready=0$
(i.e., all characters are inactive) before shuffling.

\op 0&0&k&(\hbox{$k$ bytes of alphabetic data}). Display message.
\AlphaTEX\ displays the $k$ bytes in its console lights, where $1≤k≤37$ and
the alphabetic data is expressed in ascii codes between `{\tt\ }' and
`{\tt Z}' inclusive.\xskip(Normally this command will be given only at the
beginning of each film, to show the file name being typeset.)

\op 0&1&g↓0&g↓1&y↓0&y↓1. Begin page.
Here $y=y↓1y↓0$ is the baseline
coordinate of the first line to be typeset on a new page, and $g=g↓1g↓0$
is the leftmost cog on that line; we have $0≤y≤29190$ and $2048≤g≤3781$.
\AlphaTEX\ waits until $\ready=0$ and until the film has been loaded.
Then it goes into LR state and
sets $L←g$ and $Y←y$, where $L$ and $Y$ are internal variables
representing the current left cog and baseline.
Then the machine will begin to move into
position for setting the first line of type of the new page, where this line
will begin at cog $L$ and have baseline $Y$.\xskip(Since this movement generally
takes several seconds, it is a good time to repack the character memory
before giving the contents of that first line. Note that several pages will
appear on a single sheet of film, in general.)

\op c&x↓0&x↓1&g&h. Typeset a character.
(Not allowed when \AlphaTEX\ is in blank state. \AlphaTEX\ will wait until
$\ready<2$ before processing this instruction.)\xskip Here $x=x↓1x↓0$ denotes
the left reference point (in du) at which the known character $c$ is to be placed on the
next line, where $3≤c≤255$. The left cog of this character will be $g≥0$ cogs
to the right of the previous left cog on the same line (or $g$ cogs to the right of
the line's leftmost cog, if this is the first character). The right cog of this
character will be $h≥0$ cogs to the right of the previous right cog on the same line
(or $h$ cogs to the right of the line's leftmost cog, if this is the first character).

{\sl Note:}\xskip In state RL, Alphahost must have added a ``right-to-left compensation''
to $x$ and should adjust $g$ and $h$ accordingly. This compensation accounts
for several differences affecting the way character positions on the film are
calculated when typesetting in opposite directions; some of the differences are
inherent in the hardware (due to ``backlash'') and some are in the software (due to
acceleration and interrupt delays). Alphahost should provide a test pattern
for adjusting this compensation parameter when necessary.

\op 0&0&0&d↓0&d↓1. Adjust cogs.
(Not allowed when \AlphaTEX\ is in blank state. \AlphaTEX\ will wait until
$\ready<2$ before processing this instruction.)\xskip This instruction effectively
adds $d↓1d↓0$ to the left and right cog positions of the previous character.\xskip
(It is used when a value of $g$ or $h$ greater than 255 would be needed by a normal
typesetting instruction. Note that 255 cogs is about $2{1\over4}$ inches.)

\op 0&2&g↓0&g↓1. End of line.
(At least one Typeset or Adjust-cogs instruction must have intervened since the
previous End-of-line or Begin-page instruction. It follows that $\ready<2$ and that
the state is not blank.)\xskip
In LR state, set $R←g↓1g↓0$ and go into state RL; typeset the current line
from left cog $L$ to right cog $R$. In RL state, set $L←g↓1g↓0$ and go into
state LR; typeset the current line from right cog $R$ to left cog $L$.
Right cogs are to be computed with the right-to-left compensation but left cogs
are not.

At this point, \AlphaTEX\ stores away the current value of $Y$, which will be
the baseline of the following line; then it increases
\ready\ by 1 and goes on to process the
next instruction.

Upon completion of the line, \ready\ will decrease by 1, and
the machine will begin to move vertically to the position of the next baseline.

Note that \AlphaTEX\ sets lines in alternate directions, as in
ancient Sumerian cunei\-form writing.
But as a concession to Alphahost it receives the
specifications of each line's contents from left to right.

\op 2&2&y↓0&y↓1. Feed.
Set $Y←Y+y$, where $y=y↓1y↓0$ must be at least 2 and the resulting value of
$Y$ must be in the range $0≤Y≤29190$.\xskip(The value of $Y$ is used only by
the End-of-line instruction; note that the amount to feed should be specified
before the preceding line has ended.)

\op 2&1. End film.
\AlphaTEX\ waits until $\ready=0$, then moves the film transport to home position
and signals the operator to change it.\xskip(Home position is below and left of
the lower left corner of the film.)\xskip Then \AlphaTEX\ goes into blank
state and proceeds to read the next instruction.\xskip
(This same action occurs when \AlphaTEX\ is initially started. An audio signal will
begin to sound and it will be turned off on the next Begin-Page instruction after
the operator has pushed button {\tt5}.)

\op 2&0&b↓0&b↓1. Change brightness.
\AlphaTEX\ waits until $\ready=0$, then adjusts the beam intensity on its tube.
Test patterns will be used to figure out desirable settings of the brightness
parameter $b=b↓1b↓0$.\xskip(It should be in the range $1≤b≤3000$, about 1.83
times the value used with Alphatype's standard software.
Normally this command will be given only at the
beginning of a job, before the first Begin-page instruction. An End-of-line
should appear between one Change-brightness command and the next, since the
brightness cannot change in the middle of a line.)
\vfill\eject % TALKING BACK
That completes the list of commands \AlphaTEX\ knows how to interpret. Here now
is the protocol for transmission between Alphahost and \AlphaTEX. Actually
Alphahost prepares a file of bytes for the job, containing everything but
the character boundary data; this file is transmitted by another program called
Alphaspool, which inserts the font information as needed.

$ $\AlphaTEX\ gets into initial state when it is reloaded or after it sends an
`abort' message or after it receives an `abort' message. Alphaspool gets into
initial state when it is started up. 
Let's assume that both of them are in initial state.

Alphaspool sends a sequence of $n$ bytes, where $n$ is between 0 and 63, inclusive,
followed by a sum check byte, followed by the two bytes 01101001 00000000.
The sum mod 256 of the first $n+1$ of these $n+3$ bytes is zero. Actually, if
any of the first $n+1$ bytes is 01101001, Alphaspool transmits 01101001 01101001,
since byte 01101001 is used for control information, but this double-byte
counts as only one in the count $n$. After transmitting the 01101001 00000000,
Alphaspool will wait until \AlphaTEX\ sends an acknowledgment that the bytes
were received.

$ $\AlphaTEX\ sends one-byte messages $m↓7m↓6m↓5m↓4m↓3m↓2m↓1m↓0$ to Alphaspool.
The left bits $m↓7m↓6m↓5m↓4$ are redundant: They should equal the complement of
$m↓3m↓2m↓1m↓0$, otherwise the byte has been garbled.\xskip
(In that case, an appropriate
error message should be sent from Alphaspool to its user, but Alphaspool
should attempt to keep going as if $m↓3m↓2m↓1m↓0$ were correctly transmitted.)

We have $m↓3=0$ in an acknowledgment byte. If bits $m↓2m↓1m↓0$ are also zero,
it means that the last group of $n$ bytes was received satisfactorily and
Alphaspool should send more. Otherwise it means that Alphaspool should retransmit
the last group of $n$ bytes; the error is indicated as follows: $m↓2=1$ means
a sum check error; $m↓1=1$ means a framing error (namely, a serially transmitted
character not followed by a Stop bit); $m↓0=1$ means an overrun error, either
because \AlphaTEX's interrupt server for RS232 data was too slow or because
\AlphaTEX's buffer overflowed during the transmission of the group, both of
which should be impossible.

An acknowledgment byte with $m↓3m↓2m↓1m↓0$ all zero will not be sent until
\AlphaTEX\ has enough room in its buffer to accommodate the next group of bits.
Thus, acknowledgment will come slowly if \AlphaTEX\ is doing some slow operation
like changing the brightness or waiting for the operator to change film.

If Alphaspool needs to know the status of \AlphaTEX, it sends the bytes
01101001 00000001 and waits for a response. In this case \AlphaTEX\ will
respond as soon as it can (so that a sufficiently long delay implies that \AlphaTEX\
is asleep), with $m↓3m↓2=10$. In this case $m↓1=1$ if and only if \AlphaTEX\ 
is planning to sending an acknowledgment byte as soon as there is room in its
buffer, since \AlphaTEX\ thinks
that the previous transmission was the end of a group; and $m↓0=1$ if and only
if \AlphaTEX\ is waiting for the film to be changed.\xskip(If Alphaspool has
transmitted a complete group and is waiting for an acknowledgment, it is possible
that \AlphaTEX\ doesn't know that the group has ended, since the 01101001 00000000
might not have been received. Thus if Alphaspool sends 01101001 00000001 and
gets a response with $m↓3m↓2m↓1=100$, no acknowledgment will be forthcoming and
Alphaspool can get things going by transmitting another 01101001 00000000. On the
other hand if the response has $m↓3m↓2m↓1=101$, an acknowledgment will be
forthcoming in due time, so Alphaspool should just be patient. If an acknowledgment
byte is received between Alphaspool's request and \AlphaTEX's response, bit $m↓1$
will usually be 0, but it may be 1 in unusual cases.)

If Alphaspool wants \AlphaTEX\ to abort, it sends 01101001 00000010. If \AlphaTEX\
wants Alphaspool to abort, it sends $m↓3m↓2m↓1m↓0=1111$. It sends this also
when it has been told to abort.

If \AlphaTEX\ receives 01101001 $x$ where $x$ is not specified above, a sum check
error will be reported on the next acknowledgment. Alphaspool can use this fact
to force non-acknowledgment of a group.
\vfill\eject % IMPORTANT RESTRICTIONS
\noindent {\bf Considerations from Alphahost's points of view:}\xskip
Certain additional restrictions must be met on each line that is typeset.

\yskip
\noindent\hangindent 18pt after 1\hbox to 18pt{\hfill 1) }\!
The total number of Typeset and Adjust-cogs appearing on two
consecutive lines must not exceed 200.\xskip
(There is a way to increase this parameter 200 to $200+x$ at a cost of $5x$
bytes of repertoire, by modifying an appropriate table entry in \AlphaTEX\
using the New-character instruction in a tricky way at the beginning of a job;
see the appendix.)

\yskip
\noindent\hangindent 18pt after 1\hbox to 18pt{\hfill 2) }\!
Let there be $n$ characters on a line, having respectively left and right cog
numbers $(g↓1,h↓1)$, $\ldotss$, $(g↓n,h↓n)$.\xskip (These are the absolute
cog numbers, not relative to the neighboring characters as in the Typeset-character
and Adjust-cogs instructions.)\xskip Let $g↓0=h↓0=L$ and
$g↓{n+1}=h↓{n+1}=R$, the leftmost and rightmost cogs on the line. By
the formulation of the instructions we have $g↓i≤g↓{i+1}$ and $h↓i≤h↓{i+1}$
for $0≤i<n$. We must also have
$$\vbox{\halign{\hbox par 250pt{$\bullet$ #}\cr
$g↓i≤h↓i$ for $1≤i≤n$ (nonempty characters);\cr
\noalign{\vskip 3pt}
$h↓i<g↓{i+2}$ for $1≤i≤n-2$ (no three characters in a cog);\cr
\noalign{\vskip 3pt}
$h↓i≥g↓{i+1}$ only if the sum of the ``byte times'' of characters $c↓i$ and
$c↓{i+1}$ is at most 1021 (complex characters don't overlap).\cr}}$$

\yskip\noindent
Besides these restrictions there is a ``traffic constraint'' that can be
stated as follows. For each cog $c$, count one unit of traffic for each
character (at most two) that ends at $c$, plus one unit of traffic for each
character (at most two) that begins at $c+1$, plus one unit of traffic if the
previous cog (i.e., $c-1$ or $c+1$, depending on the direction of typesetting)
has nonzero traffic. This reflects the number of complex actions needing to
be handled by \AlphaTEX\ between cogs $c$ and $c+1$, and there must be at
most three units of traffic for each cog. One simple way to enforce the traffic
constraint is to require that $g↓i<g↓{i+1}$ and $h↓i<h↓{i+1}$; \AlphaTEX\ can
handle certain cases with $g↓i=g↓{i+1}$, but it probably isn't worth the
trouble to accommodate them.

\yskip
Alphahost will know the ``byte times'' of each character from information
stored in the fonts. Indeed, for each character of a font, the following
information is given:
$$\baselineskip 14pt\vbox{\halign{\hfill$#$⊗\xskip#\hfill\cr
l,⊗leftmost bit position in the character image;\cr
r,⊗rightmost bit position in the character image, $0≤l≤r≤2047$;\cr
t,⊗byte times to generate the character;\cr
n,⊗number of bytes of boundary data;\cr}}$$
plus the boundary data bytes themselves. The left reference point of each
character is conventionally taken as bit position 360. Bit positions are in
units of du.

For each font there are two 11-bit numbers $A$ and
$B$, used by Alphahost to decide whether a `change multiplier' instruction
is necessary when changing fonts. The following formula determines the
left cog number $g$ and the right cog number $h$ for a character with
leftmost and rightmost bit positions $l$ and $r$, when the left reference
point of that character is to be at coordinate $x$ du:
$$\lineskip 4pt\vbox{\halign{\hfill#⊗$\dispstyle\null#$\hfill\cr
left cog⊗= \left\lfloor{\lfloor l\cdot A/2048\rfloor-\lfloor 360A/2048\rfloor+x
\over 32}\right\rfloor + 2048;\cr
right cog⊗= \left\lfloor{\lfloor r\cdot A/2048\rfloor-\lfloor 360A/2048\rfloor+x
\over 32}\right\rfloor + 2048.\cr}}$$
A font may contain more than 128 characters, since large characters may be
broken into several pieces.
\vfill\eject % PROCESSING SUGGESTIONS
Here is the suggested way for Alphahost to process each page: Appropriate
shifts will be added to all $x$ and $y$ coordinates so that as many pages as
possible will fit on a film. This adjustment will leave at least 1000 du to
the left and right of adjacent pages in the $x$ direction, and at least 1000 fu
in the $y$ direction. All $x$ offsets will be multiples of 32, so that
cog calculations are readily adjusted.
In particular, when setting pages that are 29 picas
$\approx$ 17121 du wide and 48 picas $\approx$ 12752 fu high (this is
standard book size for {\sl The Art of Computer Programming}), it is intended
to put six pages per sheet of film, with respective offsets respectively
given by
$$\lpile{(1024,\91000)\cr(1024,14752)\cr}\qquad
\lpile{(19168,\91000)\cr(19168,14752)\cr}\qquad
\lpile{(37312,\91000)\cr(37312,14752).\cr}$$

Within a page, suppose there are $m$ lines of type to be set, numbered from
0 to $m-1$, having respective leftmost cogs $L↓i$ and rightmost cogs $R↓i$
and with baselines $Y↓i$ in nondecreasing order. For convenience we shall
define $(L↓m,R↓m,Y↓m)=(L↓{m-1},R↓{m-1},Y↓{m-1})$.\xskip
(All $R↓i$ are computed using the right-to-left compensation, while all $L↓i$
are computed without using it. In some cases $R↓i$ will be slightly greater
than the maximum cog number 3781, because of the added compensation parameter;
this is OK as long the uncompensated cog number would have been $≤3781$.)\xskip
The even-numbered lines will be set from left to right, the odd-numbered lines
from right to left.

\yskip\noindent
The output to \AlphaTEX\ should look like this, for simplicity and reasonable
speed:

\yskip\hangindent 36pt
Begin-page.\xskip ($g=L↓0$, $y=Y↓0$, $p=$ user page number)

\yskip\hangindent 36pt
Shuffle.\xskip (Zero or more instructions that make all the known characters
contiguous in \AlphaTEX's memory; low priority characters become unknown.)

\yskip
For $0≤i<m$, perform the following:

\yskip\hangindent 54pt\noindent\hbox to 36pt{}\!
Adjust-cogs.\xskip(This instruction is given even if the appropriate amount
of adjustment is zero, to avoid empty lines and to ensure that line $i-2$ has been
finished by \AlphaTEX\ before proceeding to the next instructions.
Thus Alphahost may now regard all characters that appeared on line $i-2$ but
not on line $i-1$ as inactive.
The appropriate amount of adjustment can be calculated as follows: If $i=0$, the
adjustment is zero; if $i>0$ is even, it is $L↓i-\min(L↓{i-1},L↓i)$. If $i$ is
odd, it is $L↑\prime↓i-\min(L↓{i+1},L↓i)$, where $L↑\prime↓i$ is the position
of the leftmost cog on line $i$ when the right-to-left compensation is added.)

\yskip\hangindent 54pt\noindent\hbox to 36pt{}\!
Typeset all characters on line $i$, from left to right.\xskip
(Each Typeset instruction is preceded by Adjust-cogs
if needed, and by a New-character instruction if the character is unknown. The
New-character instruction, which may be preceded by Change-multipliers,
will usually be unnecessary because of the preloading
described below, but it may be needed; for example, it might be used
on line 0, or if there
isn't room for this character until characters from line $i-2$ become inactive.)

\yskip\hangindent 54pt\noindent\hbox to 36pt{}\!
Feed by $Y↓{i+1}-Y↓i$.\xskip(Omit this instruction if $Y↓{i+1}≤Y↓i+1$, and in
this case set $Y↓{i+1}←Y↓i$.)

\yskip\hangindent 54pt\noindent\hbox to 36pt{}\!
End-of-line. If $i$ is even, the cog parameter $g$ is $\max(R↓i,R↓{i+1})$,
otherwise $g=\min(L↓i,L↓{i+1})$.

\yskip\hangindent 54pt\noindent\hbox to 36pt{}\!
Now Alphahost issues New-character instructions for all unknown characters $c$
that appear on future lines, in priority order (first used come first), until
there are no more to load in the available memory or until both of the following
are true: \AlphaTEX\ is assumed to have completed line $i-1$ based on the timing
considerations below,
and all characters needed for line $i+1$ are either known or there is
no room for them because of active characters from line $i-1$.

\yskip\noindent
While deciding what goes on each line, Alphahost will ``drop'' characters that
either (a) are unknown and won't fit in memory, or (b) violate the
constraints stated earlier with respect to monotonic or overlapping cogs, or
(c) violate the constraint about the total number of characters on two
consecutive lines. When characters are dropped, a new line (having the same
baseline) is simply inserted, and everything eventually will get typeset.

\yskip
This recommended mode of operation has the desirable property that it almost
always keeps \AlphaTEX\ going at full speed. The above suggestions are sending font
information while $\ready=2$, so \AlphaTEX\ has to stop reading its input
only when it gets to a Begin-page or End-of-film or Change-brightness
instruction.

\yskip\noindent {\bf Timing:}\xskip
The time required to typeset a line of width $w$ inches and to feed $p$
points to the next line will be about
$$333w+\max(209,92+12.2p)\hbox{ milliseconds.}$$
For example, if we consider simple text from {\sl The Art of Computer Programming}
where $w=4.82$ and $p=12$, this comes to about 1843 milliseconds, which is
enough time to transmit about 1770 bytes at a rate of 9600 baud. A typical line of
text will require fewer than 350 bytes for its specification, not counting the
time to enter new characters from a font, so there is time to send more than 1400
bytes (roughly five characters' worth) in anticipation of future font
information needed subsequently. Experiments indicate that a lookahead of about
10 lines and the ability to load 4 new characters per line, together with a
cache of about sixty characters, avoids almost all font hangup even on
difficult math copy. Thus with a lookahead of 15 lines and the ability to
preload 5 new characters per line, together with a cache of about 80 characters,
we should obtain excellent performance.

Note that the recommendations above do not make use of any dynamic feedback from
\AlphaTEX\ about lines completed; Alphahost simply sends as many New-character
instructions as it figures there is time for, based on how long \AlphaTEX\
will take to typeset line $i-1$. In this way, an entire file of
\AlphaTEX\ instructions can be stored away by some preprocessing routine,
and the host program that communicates with \AlphaTEX\ is merely spooling this file.
\vfill\eject % OPERATOR'S MANUAL
\noindent{\bf How \AlphaTEX\ gets started} (an operator's manual){\bf:}\xskip
The code for \AlphaTEX\ normally resides on a floppy disk mounted on drive 0
(the right-hand one) of the Alphatype CRS machine. The floppy is mounted with its
Write Protect Hole uncovered and with the label to the right.

When power is turned on, the display clears and the 16K RAM boards are
checked.\xskip
(If there's an error in the first board, locations {\tt 4000} thru {\tt 7FFF},
a single row of dots is displayed. If in the second board, locations {\tt 8000}
thru {\tt BFFF}, you get two rows of dots. The recommended remedy is to try
power off and power on again; failing that, ``consult your service manual or
call Alphatype Service.'' {\sl Caution: Don't turn power off when any floppy
disks are mounted, they may be garbaged if you do.})\xskip
The positions of lens motor and feed motor are checked, and they are brought
to standard position. Then the program is loaded from the floppy into the RAM
of an Intel 8080 microcomputer located inside the machine. If anything goes
wrong during this initialization, you get the message ``{\tt 0xxx FATAL}''
where {\tt 0xxx} denotes the hexadecimal address in the bootstrap program
detecting the error. These address codes currently are:

\def\\#1:{\yskip\hangindent 36pt {#1}:\xskip\!}
\\{\tt 0008}, {\tt 0010}, {\tt 0018}, {\tt 001C}: Somehow the machine
	started executing code in part of the interrupt jump table that
	should have been disabled by the interrupt controller.\xskip
	(This probably will never happen.)

\\{\tt 006B}: Lens motor or feed motor started out at one of its extreme
	limits, needs to be moved manually by the operator.\xskip (This should never
	happen with normal usage.)

\\{\tt 007D}: The lens carriage failed to move to its correct starting position.

\\{\tt 00A6}: The feed transport failed to move to its correct starting position.

\\{\tt 00FC}: Disk contents must specify byte ``{\tt CD}'' for location {\tt 4000}.

\\{\tt 010A}: Program disk couldn't be read.

\yskip
Once the program has been loaded successfully, it displays the message
`{\tt ALPHATEX SERVER}', followed by the date of the current version and
the request `{\tt COMMAND?}'.  At this point the operator can do the
following things using the keypad (where the conventions here are compatible with
the conventions of Alphatype's standard software):

\def\key #1. #2.{\yskip\noindent Key {\tt#1}.\xskip{\bf#2.}\xskip\!}

\key 6. Go on line.
This disables all the other functions listed below, and starts up the RS232
interface to whatever host computer is supplying the information for printing.
Henceforth all you can type is
`{\tt 30}' (to abort the job) or `{\tt 5}' (to report that a sheet of film
has been loaded). The display will say `{\tt ON LINE: }'; then
an asterisk will appear on the display and an audio signal
will be given, while \AlphaTEX\ is waiting for you to load the film.

\key 8. Copy font.
(Not implemented yet, but planned for future use.)\xskip
You should previously have inserted an Alphatype Master Font into
drive 0 with the Write Protect Hole uncovered. Now the next thing you do
has to be stuck into this documentation, we're still making changes.
The font will be sent to the host computer, which will keep
it in a protected file available only to the people who have leased that
font from Alphatype Corporation.

\key 9. Initialize diskette.
You should previously have inserted a floppy into drive 1 with its Write
Protect Hole covered.\xskip (Usually this will be a brand new floppy that
needs to be formatted.)

\key A. Search for address.
When '{\tt ADDRESS }' is displayed, enter four hexadecimal digits. The first
location at which this word occurs in the internal RAM memory will be displayed.
Hit {\tt A} to get the next location; any other key exits from this routine.
Exit also happens when all occurrences have been found.

\key B. Make backup copy of program.
A previously initialized floppy should be on drive 1 with its Write Protect
Hole covered. The entire contents of the machine's RAM memory will be
written onto this diskette, thus creating a new program disk.

\key C. Correct memory.
When `{\tt ADDRESS }' is displayed, enter four hexadecimal digits giving an
address in the range {\tt 4000} to {\tt BFFF}. The current contents of the
byte at that address will be displayed. Enter the new hexadecimal value
(two digits from {\tt 00} to {\tt FF}). Then hit {\tt A} to advance to the next
address, or hit {\tt B} to go back to the same one again, hit {\tt C} to change
to a new address, hit {\tt D} to descend to the previous address, hit {\tt E}
to exit, or hit {\tt F} go forward; of these options, only {\tt A} actually
stores the byte you entered. Any numeric key ({\tt 0} to {\tt9}) stores the
byte and exits from this routine.

\key D. Dump trace information.
(For wizards only, when diagnosing potential \AlphaTEX\ errors; this sends
information to a special host program. Pushing any key will interrupt the
process, after which you can resume later if you want to.)

\key E. Enter a new program.
(For wizards only. It loads a new \AlphaTEX\ program in ``{\tt.HEX}'' format.)

\key F. Flash the lights.
You get a more-or-less random test pattern on the console display, for
your amusement.

\yskip
\noindent Any other key (namely {\tt 0}, {\tt 1}, {\tt 2}, {\tt 3}, {\tt 4},
{\tt 5}, {\tt 7}) causes you to get asked for another command.

\yskip
{\it Note:\/} If an error message appears other than `{\tt FATAL}', hit any
key to restart. For example, you might get the message `{\tt CANNOT WRITE
ON DISK 1}'.

\yskip\yskip
\noindent If the computer on which Alphahost is running goes down, one
way to get in synch again is to abort the job (type `{\tt30}'), thereby
resetting \AlphaTEX\ as if you had reloaded it. Replace the film. When
the host computer comes up, things should work as if a new job has started.
\vfill\eject % APPENDIX
\noindent{\bf Appendix:} Changing the line buffer length.

\vskip 3pt
\noindent The following canned sequence of bytes should appear at the
very beginning of a job if the line buffer length is to be varied:
$$0&3&m↓0&m↓1&2&0&r↓{20}&r↓{21}.$$
(A special case of `New-character'.)\xskip
Here $m↓1m↓0=\hbox{\tt 7F15}$ is the location of the special internal
\AlphaTEX\ variable {\tt LB0},
and $r↓2=r↓{21}r↓{20}$ is {\tt C000} minus 5 times the
desired line buffer length.\xskip
(Normally $r↓2=\hbox{\tt BC18}$.)
\vfill\end